define(['yf','jquery','text!./template/priceTpl.html'],function(yf,$,priceTpl){
	var me;
	var main = {
		initialize:function(){
			me = this;
            me.createPrice();
		},
		
		bindEvents:{
			"click .priceSection":"goCarList"
		},
		
        createPrice:function(){
        	$.ajax({
        		type:"get",
        		url:"./data/price.json",
        		async:true,
        		success:function(data){
        			if(typeof data == "string"){
        				data = JSON.parse(data);
        			}
        			me.$el.find('.priceSectionDiv').html(_.template($(priceTpl).html())({result:data.data}));
        		}
        	});
        },
        
        goCarList:function(e){
        	var target = $(e.currentTarget);
        	var code = target.attr('data-code');
        	var navigateArg = {
        		code:code
        	}
        	var url = "carList";
        	yf.navigate(url,navigateArg);
        }
        
	}
	return main;
});